package top.buluoluo.ordersservice.enums;

import lombok.Getter;

@Getter
public enum OrderPaymentMethod {
    ALIPAY("支付宝"),
    WECHAT("微信支付"),
    UNIONPAY("银联支付"),
    COD("货到付款");

    private final String description;

    OrderPaymentMethod(String description) {
        this.description = description;
    }

    /**
     * 安全转换方法
     */
    public static OrderPaymentMethod fromValue(String value) {
        for (OrderPaymentMethod method : values()) {
            if (method.name().equalsIgnoreCase(value)) {
                return method;
            }
        }
        throw new IllegalArgumentException("未知支付方式: " + value);
    }
}